<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>取派标准</title>
		<!-- 导入jquery核心类库 -->
		<script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
		<!-- 导入easyui类库 -->
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/ext/portal.css">
		<link rel="stylesheet" type="text/css" href="../../css/default.css">
		<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.portal.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.cookie.js"></script>
		<script src="../../js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
		<script type="text/javascript">
			$(function(){
				// 先将body隐藏，再显示，不会出现页面刷新效果
				$("body").css({visibility:"visible"});
				
				// 收派标准信息表格
				$('#grid').datagrid( {
					iconCls : 'icon-forward',
					fit : true,
					border : false,
					rownumbers : true,
					striped : true,
					pageList: [10,25,50],
					pagination : true,
					toolbar : toolbar,
					url : "../../standard_pageQuery.action",
					idField : 'id',
					columns : columns
				});
                $('#save').click(function(){
                           var form = $('#standard_save_1').form('validate');
                           if (form) {
                        $('#standard_save_1').submit();
                    }else{
                        $.messager.alert('警告!','请完善信息!','warning');
                    }


                });
                //服务器接收数据必须是精度整形则接收不了
            /*     $('#n1').numberbox({
                     precision:1

                 });
                 $('#n2').numberbox({
                     precision:1

                 });
                 $('#n3').numberbox({
                     precision:1

                 });
                 $('#n4').numberbox({
                     precision:1

                 });*/


             });



             //工具栏
             var toolbar = [ {
                 id : 'button-add',
                 text : '增加',
                 iconCls : 'icon-add',
                 handler : function(){
                     $('#standardWindow').window('open')
                 }
             }, {
                 id : 'button-edit',
                 text : '修改',
                 iconCls : 'icon-edit',
                 handler : function(){
                     var selections = $('#grid').datagrid('getSelections')
                     if (selections.length!=1) {
                         $.messager.alert('提示信息','请选中或选择一行','warning')
                     }else{
                         $('#standard_save_1').form('load',selections[0])
                         $('#standardWindow').window('open')
					 }
                 }
             },{
                 id : 'button-delete',
                 text : '作废',
                 iconCls : 'icon-cancel',
                 handler : function(){
                     var selections = $('#grid').datagrid('getSelections')

                         $.messager.confirm('警告!','确定删除?',function (result) {
                             if (result) {
                                       var standardList=[];
                                for (var i=0;i<selections.length;i++){
                                    standardList.push(selections[i].id)

								}

                                 $.get('/standard_delete.action?ids='+standardList).then(function (data) {
                                     if (data) {
                                         location.reload();
                                     }else{
                                         $.messager.alert('error','网络延迟,请重试','info')
									 }

                                 })

                             }
                         })



                 }
             },{
                 id : 'button-restore',
                 text : '还原',
                 iconCls : 'icon-save',
                 handler : function(){
                    location.reload();
                 }
             }];

             // 定义列
             var columns = [ [ {
                 field : 'id',
                 checkbox : true
             },{
                 field : 'name',
                 title : '标准名称',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'minWeight',
                 title : '最小重量',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'maxWeight',
                 title : '最大重量',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'minLength',
                 title : '最小长度',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'maxLength',
                 title : '最大长度',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'operator',
                 title : '操作人',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'operatingTime',
                 title : '操作时间',
                 width : 120,
                 align : 'center'
             }, {
                 field : 'company',
                 title : '操作单位',
                 width : 120,
                 align : 'center'
             } ] ];
</script>
	</head>

	<body class="easyui-layout" style="visibility:hidden;">
		<div region="center" border="false">
			<table id="grid"></table>
		</div>
		
		<div class="easyui-window" title="对收派标准进行添加或者修改" id="standardWindow" collapsible="false" minimizable="false" maximizable="false" modal="true" closed="true" style="width:600px;top:50px;left:200px">
			<div region="north" style="height:31px;overflow:hidden;" split="false" border="false">
				<div class="datagrid-toolbar">
					<a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true">保存</a>
				</div>
			</div>

			<div region="center" style="overflow:auto;padding:5px;" border="false">
				
				<form id="standard_save_1" action="/standard_save.action" method="post">
					<table class="table-edit" width="80%" align="center">
						<tr class="title">
							<td colspan="2">收派标准信息
								<!--提供隐藏域 装载id -->
								<input type="hidden" name="id" />
							</td>
						</tr>
						<tr>
							<td>收派标准名称</td>
							<td>
								<input type="text" name="name" 
									class="easyui-validatebox" id="verification" data-options="required:true" />
							</td>
						</tr>
						<tr>
							<td>最小重量</td>
							<td>
								<input type="text" name="minWeight" 
										class="easyui-numberbox" id="n1" required="true" />
							</td>
						</tr>
						<tr>
							<td>最大重量</td>
							<td>
								<input type="text" name="maxWeight" id="n2" class="easyui-numberbox " required="true" />
							</td>
						</tr>
						<tr>
							<td>最小长度</td>
							<td>
								<input type="text" name="minLength" id="n3" class="easyui-numberbox" required="true" />
							</td>
						</tr>
						<tr>
							<td>最大长度</td>
							<td>
								<input type="text" name="maxLength" id="n4" class="easyui-numberbox" required="true" />
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</body>

</html>